function WorkerLight() {
};

WorkerLight.instance = function(callbackFunc) {
  var popupBox = new PopupBox(), _self = this;
  
  var model = Model.instance('{{$smarty.const.MODEL_NAME_USER_LIGHT|escape:javascript}}', '{{$smarty.const.MODEL_TITLE_USER_LIGHT|escape:javascript}}', '{{$smarty.const.MODEL_TYPE_PRODUCT|escape:javascript}}');
  
  //Create model here...
  var state1 = State.instance(model, 0, 'not activate (No Wedding Day)');
  var state2 = State.instance(model, 1, 'arrange lighting assistant');
  var state3 = State.instance(model, 2, 'confirm lighting assistant');
  var state4 = State.instance(model, 3, 'remind lighting assistant');
  var state5 = State.instance(model, 4, 'job completed by lighting assistant');
  var transition1 = Transition.instance('arrange', state2, state3, '{{$smarty.const.USER_TYPE_MANAGER_ASSISTANT|escape:javascript}}', DlmanageUtils.dop, -30);
  var transition2 = Transition.instance('confirmed', state3, state4, '{{$smarty.const.USER_TYPE_MANAGER_ASSISTANT|escape:javascript}}', DlmanageUtils.dop, -2);
  var transition3 = Transition.instance('reminded', state4, state5, '{{$smarty.const.USER_TYPE_MANAGER_ASSISTANT|escape:javascript}}', DlmanageUtils.none);
  
  var transition4 = Transition.instance('arrange', state2, state3, '{{$smarty.const.USER_TYPE_MANAGER|escape:javascript}}', DlmanageUtils.dop, -30);
  var transition5 = Transition.instance('confirmed', state3, state4, '{{$smarty.const.USER_TYPE_MANAGER|escape:javascript}}', DlmanageUtils.dop, -2);
  var transition6 = Transition.instance('reminded', state4, state5, '{{$smarty.const.USER_TYPE_MANAGER|escape:javascript}}', DlmanageUtils.none);
  
  var transition7 = Transition.instance('arrange', state2, state3, '{{$smarty.const.USER_TYPE_ADMIN|escape:javascript}}', DlmanageUtils.dop, -30);
  var transition8 = Transition.instance('confirmed', state3, state4, '{{$smarty.const.USER_TYPE_ADMIN|escape:javascript}}', DlmanageUtils.dop, -2);
  var transition9 = Transition.instance('reminded', state4, state5, '{{$smarty.const.USER_TYPE_ADMIN|escape:javascript}}', DlmanageUtils.none);
  
  transition1.operate = function(pos, callbackFunc, produce, user, date, options) { if (!options) {
                                                                                      options = {};
                                                                                    }
                                                                                    var previous = MiscUtils.clone(produce);
                                                                                    options.previous = previous;
                                                                                    var div = document.createElement('div');
                                                                                    var func1 = function() { if (!options) {
                                                                                                               options = {};
                                                                                                             }
                                                                                                             if (produce.user_account == '') {
                                                                                                               window.alert('选择一个工作人员');
                                                                                                               return;
                                                                                                             }
                                                                                                             options.extra = produce.user_account;
                                                                                                             DlmanageUtils.operate(transition1, pos, callbackFunc, produce, user, date, options);
                                                                                                             popupBox._close();
                                                                                                           };
                                                                                    var func2 = function() { popupBox._close();
                                                                                                             callbackFunc();
                                                                                                           };
                                                                                    MiscUtils.dialog(popupBox, pos, div, func1, func2);
                                                                                    new DialogAssignee(div, produce, { php: 'customphp/mysqlread.php', condition: 'd.lEnabled = 1', orderTrackId: produce.orderTrackId });
                                                                                  };
  
  transition3.operate = function(pos, callbackFunc, produce, user, date, options) { if (!options) {
                                                                                      options = {};
                                                                                    }
                                                                                    var previous = MiscUtils.clone(produce);
                                                                                    options.previous = previous;
                                                                                    options.stage = 2;
                                                                                    options.func = function(div, customer, options) { new DialogLocation(div, customer, options); };
                                                                                    DlmanageUtils.operate3(transition3, pos, callbackFunc, produce, user, date, options);
                                                                                  };
                                                                                  
  transition4.operate = function(pos, callbackFunc, produce, user, date, options) { if (!options) {
                                                                                      options = {};
                                                                                    }
                                                                                    var previous = MiscUtils.clone(produce);
                                                                                    options.previous = previous;
                                                                                    var div = document.createElement('div');
                                                                                    var func1 = function() { if (!options) {
                                                                                                               options = {};
                                                                                                             }
                                                                                                             if (produce.user_account == '') {
                                                                                                               window.alert('选择一个工作人员');
                                                                                                               return;
                                                                                                             }
                                                                                                             options.extra = produce.user_account;
                                                                                                             DlmanageUtils.operate(transition4, pos, callbackFunc, produce, user, date, options);
                                                                                                             popupBox._close();
                                                                                                           };
                                                                                    var func2 = function() { popupBox._close();
                                                                                                             callbackFunc();
                                                                                                           };
                                                                                    MiscUtils.dialog(popupBox, pos, div, func1, func2);
                                                                                    new DialogAssignee(div, produce, { php: 'customphp/mysqlread.php', condition: 'd.lEnabled = 1', orderTrackId: produce.orderTrackId });
                                                                                  };

  transition6.operate = function(pos, callbackFunc, produce, user, date, options) { if (!options) {
                                                                                      options = {};
                                                                                    }
                                                                                    var previous = MiscUtils.clone(produce);
                                                                                    options.previous = previous;
                                                                                    options.stage = 2;
                                                                                    options.func = function(div, customer, options) { new DialogLocation(div, customer, options); };
                                                                                    DlmanageUtils.operate3(transition6, pos, callbackFunc, produce, user, date, options);
                                                                                  };
transition7.operate = function(pos, callbackFunc, produce, user, date, options) { if (!options) {
                                                                                    options = {};
                                                                                  }
                                                                                  var previous = MiscUtils.clone(produce);
                                                                                  options.previous = previous;
                                                                                  var div = document.createElement('div');
                                                                                  var func1 = function() { if (!options) {
                                                                                                             options = {};
                                                                                                           }
                                                                                                           if (produce.user_account == '') {
                                                                                                             window.alert('选择一个工作人员');
                                                                                                             return;
                                                                                                           }
                                                                                                           options.extra = produce.user_account;
                                                                                                           DlmanageUtils.operate(transition7, pos, callbackFunc, produce, user, date, options);
                                                                                                           popupBox._close();
                                                                                                         };
                                                                                  var func2 = function() { popupBox._close();
                                                                                                           callbackFunc();
                                                                                                         };
                                                                                  MiscUtils.dialog(popupBox, pos, div, func1, func2);
                                                                                  new DialogAssignee(div, produce, { php: 'customphp/mysqlread.php', condition: 'd.lEnabled = 1', orderTrackId: produce.orderTrackId });
                                                                                };

transition9.operate = function(pos, callbackFunc, produce, user, date, options) { if (!options) {
                                                                                    options = {};
                                                                                  }
                                                                                  var previous = MiscUtils.clone(produce);
                                                                                  options.previous = previous;
                                                                                  options.stage = 2;
                                                                                  options.func = function(div, customer, options) { new DialogLocation(div, customer, options); };
                                                                                  DlmanageUtils.operate3(transition9, pos, callbackFunc, produce, user, date, options);
                                                                                };
  model.states = [ state1, state2, state3, state4, state5 ];
  model.transitions = [ transition1, transition2, transition3, transition4, transition5, transition6, transition7, transition8, transition9 ];
  return model;
};